import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
// pinia没有mutatios和modules

//defineStore 创建一个store实例 counter 是这个store的id
// export const useCounterStore = defineStore("counter", () => {
//     const count = ref(0);//state
//     const a = ref(1);
//     const doubleCount = computed(() => count.value * 2);//getters
//     // acitons
//     function increment() {
//         count.value++
//     }
//     return { count, a, doubleCount, increment };
// })
//第二种写法
export const useCounterStore = defineStore("counter", {
    state: () => {
        return {
            isCollapse: false
        };
    },
    getters: {
        // doubleCount:(state) =>{
        //     return state.count*2;
        // }
    },
    actions: {
        increment() {
            this.isCollapse = !this.isCollapse;
        }
    }
});